home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 306 < prev    next >
Text File  |  1996-08-06  |  1KB  |  41 lines

  1. Newsgroups: comp.std.c
  2. Message-ID: <4esi6d$m3g@news.bmw.de>
  3. From: frankro@bmw.de (Dr. R. Frank)
  4. Path: news.bmw.de!usenet!frankro
  5. Subject: Re: HELP!! Beginner's question...
  6. Date: Fri, 02 Feb 1996 07:32:13 +0000
  7. References: <Pine.OSF.3.91l.960131005708.7552A-100000@saul3.u.washington.edu>
  8. X-Gateway: ZCONNECT XX ius.gun.de [UNIX/Connect v0.73]
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=ISO-8859-1
  11. Content-Transfer-Encoding: 8bit
  12.  
  13. Ramon Mariano Jr <rmariano@u.washington.edu> wrote:
  14. >Hello everybody!
  15. >
  16. >I'm a beginning C-programmer ...
  17. >                  
  18. >int main(void)
  19. >{
  20. >   int i,         /* integer */
  21. >       n,         /* power to raise integer */
  22. >       i_total,   /* integer's total value*/
  23. >       count;     /* keeps track of number of loops run */
  24.  
  25. You must declare: int i, n, count;
  26.   but:  long i_total;
  27. >
  28. >   /* asks for an integer and stores it in 'i' */
  29.   .
  30.   .
  31.   .......
  32. >    for (count = 1;  count <= n;  count = count + 1){
  33. >        i_total = i_total * i;
  34.  you can write in C:
  35.      for (count = 1; count <= n; count++)
  36.          i_total *= i; 
  37.  
  38. I hope, that this will help you!
  39. Robert
  40.  
  41.